<?php 
        if (!current_user_can('manage_options'))
		{
			wp_die('You do not have sufficient permissions to access this page.');
		}
                        $pagination_coupon_codes = get_option('pagination_coupon_codes');
                        $exclusive = get_option('exclusive');
                        $popular = get_option('popular');
                        $pagination_category = get_option('pagination_category');
                        $pagination_404 = get_option('pagination_404');
                ?>
                    <div class="wrap">
                    <?php screen_icon('themes'); ?> <h2>Pagination Setting</h2>
                    <form method="POST" action="">  
                        <table class="form-table">  
                            <tr valign="top">
                                <th scope="row">
                                    <label for="pagination_coupon_codes">Number/page of Coupon codes page</label>   
                                </th>  
                                <td>  
                                    <input value="<?php echo ($_POST['pagination_coupon_codes']?$_POST['pagination_coupon_codes']:$pagination_coupon_codes); ?>" name="pagination_coupon_codes" type="text" style="width: 250px;"/>  
                                </td>  
                            </tr>
                            <tr valign="top">
                                <th scope="row">
                                    <label for="exclusive">Number/page of Exclusive page</label>   
                                </th>  
                                <td>  
                                    <input value="<?php echo ($_POST['exclusive']?$_POST['exclusive']:$exclusive); ?>" name="exclusive" type="text" style="width: 250px;"/>  
                                </td>  
                            </tr>
                            <tr valign="top">
                                <th scope="row">
                                    <label for="popular">Number/page of Popular page</label>   
                                </th>  
                                <td>  
                                    <input value="<?php echo ($_POST['popular']?$_POST['popular']:$popular); ?>" name="popular" type="text" style="width: 250px;"/>  
                                </td>  
                            </tr>
                            <tr valign="top">
                                <th scope="row">
                                    <label for="pagination_404">Number/page of Category single</label>   
                                </th>  
                                <td>  
                                    <input value="<?php echo ($_POST['pagination_category']?$_POST['pagination_category']:$pagination_category); ?>" name="pagination_category" type="text" style="width: 250px;"/>  
                                </td>  
                            </tr>
                            <tr valign="top">
                                <th scope="row">
                                    <label for="pagination_404">Count coupon show in 404 and browse Category</label>   
                                </th>  
                                <td>  
                                    <input value="<?php echo ($_POST['pagination_404']?$_POST['pagination_404']:$pagination_404); ?>" name="pagination_404" type="text" style="width: 250px;"/>  
                                </td>  
                            </tr>
                        </table>
                        <p>  
                            <input type="submit" value="Save settings" class="button-primary"/>
                        </p>   
                    </form>  
                    </div>
                   <?php  
        if(
            isset($_POST['pagination_coupon_codes']) ||
            isset($_POST['exclusive']) ||
            isset($_POST['popular']) ||    
            isset($_POST['pagination_category']) ||
            isset($_POST['pagination_404'])
        )
        {
            //update facebook page url
            $new_code = esc_attr($_POST['pagination_coupon_codes']);
            update_option('pagination_coupon_codes',$new_code);
            $new_exclusive = esc_attr($_POST["exclusive"]);
            update_option('exclusive',$new_exclusive);
            $new_popular = esc_attr($_POST["popular"]);
            update_option('popular',$new_popular);
            $new_category = esc_attr($_POST["pagination_category"]);
            update_option('pagination_category',$new_category);
            $new_404 = esc_attr($_POST["pagination_404"]);
            update_option('pagination_404',$new_404);
            // print success message
            echo '<div id="message" class="updated">Settings saved</div>';
        }
        ?>